package avicit.bdp.dgs.metadata.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.LogField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.apache.commons.lang3.StringUtils;

/**
 * @author mayi 元数据采集任务
 */
@ApiModel(value = "MetadataCollectTaskDTO", description = "元数据采集任务")
@Table(name = "bdp_dgs_metadata_collect_task")
public class MetadataCollectTaskDTO extends BaseDTO {

  private static final long serialVersionUID = 1L;

  /** 主键ID */
  @LogField
  @ApiModelProperty(value = "主键")
  @FieldRemark(column = "id", field = "id", name = "主键")
  @Column(name = "id")
  @avicit.platform6.core.annotation.log.Id
  @javax.persistence.Id
  private String id;

  /** 任务名称 */
  @LogField
  @ApiModelProperty(value = "任务名称", name = "name")
  @FieldRemark(column = "name", field = "name", name = "任务名称")
  private String name;

  /** 所属分类 */
  @LogField
  @ApiModelProperty(value = "所属分类", name = "typeId")
  @FieldRemark(column = "type_id", field = "typeId", name = "所属分类")
  private String typeId;

  /** 负责人 */
  @LogField
  @ApiModelProperty(value = "负责人", name = "owner")
  @FieldRemark(column = "owner", field = "owner", name = "负责人")
  private String owner;

  /** 采集后表归属目录 */
  @LogField
  @ApiModelProperty(value = "采集后表归属目录")
  @FieldRemark(
      column = "table_belong_catalog_id",
      field = "tableBelongCatalogId",
      name = "采集后表归属目录")
  private String tableBelongCatalogId;

  /** 采集后表归属目录 */
  @LogField
  @ApiModelProperty(value = "采集后表归属目录")
  @Transient
  private String tableBelongCatalogName;

  /** 元数据类型 */
  @LogField
  @ApiModelProperty(value = "元数据类型")
  @FieldRemark(column = "metadata_type", field = "metadataType", name = "元数据类型")
  private Integer metadataType;

  /** 数据源类型 */
  @LogField
  @ApiModelProperty(value = "数据源类型")
  @FieldRemark(column = "datasource_type", field = "datasourceType", name = "数据源类型")
  private String datasourceType;

  /** 数据源 */
  @LogField
  @ApiModelProperty(value = "数据源")
  @FieldRemark(column = "datasource_id", field = "datasourceId", name = "数据源")
  private String datasourceId;

  /** 是否采集整库 */
  @LogField
  @ApiModelProperty(value = "是否采集整库")
  @FieldRemark(column = "all_database", field = "allDatabase", name = "是否采集整库")
  private Integer allDatabase;

  /** 采集表范围(逗号分割) */
  @LogField
  @ApiModelProperty(value = "采集表范围(逗号分割)")
  @FieldRemark(column = "tables", field = "tables", name = "采集表范围(逗号分割)")
  private String tables;

  /** 任务描述 */
  @LogField
  @ApiModelProperty(value = "任务描述", name = "remark")
  @FieldRemark(column = "remark", field = "remark", name = "任务描述")
  private String remark;

  /** 是否启用，停用：0，启用：1 */
  @LogField
  @ApiModelProperty(value = "是否启用，停用：0，启用：1")
  @FieldRemark(column = "enable", field = "enable", name = "是否启用")
  private Integer enable;

  /** 启用定时任务，是：1，否：0 */
  @LogField
  @ApiModelProperty(value = "启用定时任务，是：1，否：0")
  @FieldRemark(column = "enable_cron_tab", field = "enableCronTab", name = "启用定时任务，是：1，否：0")
  private Integer enableCronTab;

  /** 调度流程定义id */
  @LogField
  @ApiModelProperty(value = "流程定义id")
  @FieldRemark(column = "process_definition_id", field = "processDefinitionId", name = "ds流程定义id")
  private String processDefinitionId;

  @Transient
  @ApiModelProperty(value = "数据源名称")
  private String datasourceName;

  /** 定时任务数量 */
  @LogField
  @ApiModelProperty(value = "定时任务数量")
  @FieldRemark(column = "cron_task_num", field = "cronTaskNum", name = "定时任务数量")
  private Integer cronTaskNum;

  @Transient private transient String ownerName;

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getTypeId() {
    return typeId;
  }

  public void setTypeId(String typeId) {
    this.typeId = typeId;
  }

  public String getRemark() {
    return remark;
  }

  public void setRemark(String remark) {
    this.remark = remark;
  }

  public Integer getEnable() {
    return enable;
  }

  public void setEnable(Integer enable) {
    this.enable = enable;
  }

  public String getOwner() {
    return owner;
  }

  public void setOwner(String owner) {
    this.owner = owner;
  }

  public String getTableBelongCatalogId() {
    return tableBelongCatalogId;
  }

  public void setTableBelongCatalogId(String tableBelongCatalogId) {
    this.tableBelongCatalogId = tableBelongCatalogId;
  }

  public String getDatasourceType() {
    return datasourceType;
  }

  public void setDatasourceType(String datasourceType) {
    this.datasourceType = datasourceType;
  }

  public String getDatasourceId() {
    return datasourceId;
  }

  public void setDatasourceId(String datasourceId) {
    this.datasourceId = datasourceId;
  }

  public Integer getAllDatabase() {
    return allDatabase;
  }

  public void setAllDatabase(Integer allDatabase) {
    this.allDatabase = allDatabase;
  }

  public String getTables() {
    return tables;
  }

  public void setTables(String tables) {
    this.tables = tables;
  }

  public Integer getMetadataType() {
    return metadataType;
  }

  public void setMetadataType(Integer metadataType) {
    this.metadataType = metadataType;
  }

  public Integer getEnableCronTab() {
    return enableCronTab;
  }

  public void setEnableCronTab(Integer enableCronTab) {
    this.enableCronTab = enableCronTab;
  }

  public String getProcessDefinitionId() {
    return processDefinitionId;
  }

  public void setProcessDefinitionId(String processDefinitionId) {
    this.processDefinitionId = processDefinitionId;
  }

  public String getDatasourceName() {
    return datasourceName;
  }

  public void setDatasourceName(String datasourceName) {
    this.datasourceName = datasourceName;
  }

  public String getTableBelongCatalogName() {
    return tableBelongCatalogName;
  }

  public void setTableBelongCatalogName(String tableBelongCatalogName) {
    this.tableBelongCatalogName = tableBelongCatalogName;
  }

  public Integer getCronTaskNum() {
    return cronTaskNum;
  }

  public void setCronTaskNum(Integer cronTaskNum) {
    this.cronTaskNum = cronTaskNum;
  }

  public String getOwnerName() {
    return ownerName;
  }

  public void setOwnerName(String ownerName) {
    this.ownerName = ownerName;
  }

  @Override
  public String getLogFormName() {
    if (StringUtils.isEmpty(super.logFormName)) {
      return "元数据模块";
    } else {
      return super.logFormName;
    }
  }

  @Override
  public String getLogTitle() {
    if (StringUtils.isEmpty(super.logTitle)) {
      return "元数据采集";
    } else {
      return super.logTitle;
    }
  }

  @Override
  public String toString() {
    return "MetadataCollectTaskDTO{"
        + "id='"
        + id
        + '\''
        + ", name='"
        + name
        + '\''
        + ", typeId='"
        + typeId
        + '\''
        + ", owner='"
        + owner
        + '\''
        + ", tableBelongCatalogId='"
        + tableBelongCatalogId
        + '\''
        + ", metadataType="
        + metadataType
        + ", datasourceType='"
        + datasourceType
        + '\''
        + ", datasourceId='"
        + datasourceId
        + '\''
        + ", tables='"
        + tables
        + '\''
        + ", remark='"
        + remark
        + '\''
        + ", enable="
        + enable
        + ", enableCronTab="
        + enableCronTab
        + ", processDefinitionId="
        + processDefinitionId
        + '}';
  }
}
